<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>计费后台管理</title>
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/css/managercss.css">
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/css/wbox.css">
<script type="text/javascript" src="<%=request.getContextPath() %>/js/jquery-1.4.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/jquery.form.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/wbox.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/validate.js"></script>
<script type="text/javascript">
<!--
	$(function(){
		$(".list div").mousemove(function(){
			$(this).css("background","#E3EEFF");
		}).mouseout(function(){
			$(this).css("background","");
		});
		$("#add").click(function(){
			if($("input:checked[name=productId]").size()>0){
				var date = $("#productForm").formSerialize();
				$.ajax({
					url:"<%=request.getContextPath()%>/admin/mobile/addbatch/${mobileType.mobileTypeId}",
					type:"POST",
					data:date,
					success:function(flag){
						if(flag=='1'){
							alert("内置成功!");
							window.location.href="<%=request.getContextPath() %>/admin/mobile/${company.companyId}/${mobileType.mobileTypeId}";
						}else{
							alert("内置失败!");
						}
					}
				});
				return;
			}else{
				alert("请至少选择一个产品!");
				return;
			}
		});

		$("#del").click(function(){
			if($("input:checked[name=id]").size()>0){
				var date = $("#productForm").formSerialize();
				$.ajax({
					url:"<%=request.getContextPath()%>/admin/mobile/delbatch/${mobileType.mobileTypeId}",
					type:"POST",
					data:date,
					success:function(flag){
						if(flag=='1'){
							alert("取消内置成功!");
							window.location.href="<%=request.getContextPath() %>/admin/mobile/${company.companyId}/${mobileType.mobileTypeId}";
						}else{
							alert("取消内置失败!");
						}
					}
				});
				return;
			}else{
				alert("请至少选择一个产品!");
				return;
			}
		});
	});
//-->
</script>
</head>
<body>
<div class="information">
	<div class="listTitle">
		<ul>
			<li style="width:50px;">编号</li>
			<li style="width:200px;">产品名称</li>		
			<li style="width:100px;">内置</li>
			<li style="width:100px;">取消</li>
		</ul>
		<div class="clear"></div>
	</div>
	<div class="list">
		<form id="productForm">
		<c:forEach items="${pageBean.result}" var="product" varStatus="status">
			<div class="${status.index%2==0?'noselect':'select' }">
				<ul>
					<li style="width:50px;">${status.index+1+pageBean.start }</li>
					<li style="width:200px;">${product.productName }</li>		
					<li style="width:100px;">
						<c:choose>
							<c:when test="${product.id!=0}">已内置</c:when>
							<c:otherwise><input type="checkbox" name="productId" value="${product.productId }"/></c:otherwise>
						</c:choose>
					</li>
					<li style="width:100px;">
						<c:choose>
							<c:when test="${product.id==0}">未内置</c:when>
							<c:otherwise><input type="checkbox" name="id" value="${product.id }"/></c:otherwise>
						</c:choose>
					</li>
				</ul>
				<div class="clear"></div>
			</div>
		</c:forEach>
		</form>
		<div class="noselect">
			<ul>
				<li style="width:50px;">&nbsp;</li>
				<li style="width:200px;"><span style="font-weight: bold;">操作</span></li>
				<li style="width:100px;"><input type="button" name="add" id="add" value="内置产品"/></li>
				<li style="width:100px;"><input type="button" name="del" id="del" value="取消内置"/></li>
			</ul>
			<div class="clear"></div>
		</div>
	</div>
	<jsp:include page="../page.jsp" flush="true"></jsp:include>
</div>
</body>
</html>